package com.example.zselasticsearchsf.domain;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.io.Serializable;

/**
 * @Author: Steven
 * @Date: 2021/11/18 9:08
 */

@Mapping(mappingPath = "/json/poi-mapping.json")
@Document(
        indexName = "poi",
        type = "point",
        shards = 5,
        replicas = 0,
        refreshInterval = "1s",
        indexStoreType = "fs")
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class GeoPointBean implements Serializable {
    private static final long serialVersionUID = 2084886055991558779L;

    @Id
    @JSONField(ordinal = 1)
    private String id;

    @Field(type = FieldType.Keyword)
    @JSONField(ordinal = 2)
    private String type;

    @GeoPointField
    @JSONField(ordinal = 3)
    private Object location;

    // 配置date序列化和反序列使用yyyyMMdd日期格式
//    @JSONField(format="")
}
